﻿using System;
using QFramework;
using UnityEngine;

namespace ProjectSurvivor
{
    public abstract class GamePlayObject : ViewController
    {
        public bool InScreen { get; set; }
        protected abstract Collider2D collider2d { get; }
        
        // 在可视范围内
        private void OnBecameVisible()
        {
            collider2d.enabled = true;
            InScreen = true;
        }

        // 可视范围外
        private void OnBecameInvisible()
        {
            collider2d.enabled = false;
            InScreen = false;
        }
    }
}